Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

This PR adds unit tests to the eldritch-core interpreter's operation modules (slicing.rs and arithmetic.rs).

Changes:

  1. implants/lib/eldritchv2/eldritch-core/src/interpreter/operations/slicing.rs: Added a #[cfg(test)] mod tests block.

    • Tests adjust_slice_indices logic in isolation.
    • Covers positive/negative steps, start/stop defaults, negative indices (wrapping), and out-of-bounds clamping.
    • Explicitly validates behavior for edge cases like empty slices and step direction conflicts.
  2. implants/lib/eldritchv2/eldritch-core/src/interpreter/operations/arithmetic.rs: Added a #[cfg(test)] mod tests block.

    • Tests apply_arithmetic_op by instantiating a minimal Interpreter.
    • Validates integer, float, and mixed-type arithmetic.
    • Ensures correct error handling for division by zero.
    • Verifies Python-compliant behavior for modulo (%) and floor division (//) with negative operands.

Verification:

  • Ran cargo test -p eldritch-core operations::slicing and operations::arithmetic 20 times locally without failure.
  • Confirmed that slicing.rs tests cover the pure logic function comprehensively.
  • Confirmed that arithmetic.rs tests correctly simulate interpreter execution for operations.

PR created automatically by Jules for task 17726640734134341644 started by @KCarretto

Added comprehensive unit tests to `slicing.rs` and `arithmetic.rs` in `eldritch-core`.
- `slicing.rs`: Added unit tests for `adjust_slice_indices` covering defaults, negative indices, negative steps, and out-of-bounds clamping.
- `arithmetic.rs`: Added unit tests for `apply_arithmetic_op` covering integer/float arithmetic, mixed types, zero division errors, and Python-compatible modulo/floor division behavior.

These tests improve coverage for core interpreter operations and ensure stability of edge cases. Verified with 20 consecutive runs.
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 12, 2026

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2308    ±0 2307    ±0 1    ±0 0    ±0 0    ±0 0    ±0 1ms    ±0

Previous Results

Build 🏗️ Result 🧪 Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
#423 2308 2307 1 0 0 0 29.9s

Insights

Average Tests per Run Total Flaky Tests Total Failed Slowest Test (p95)
2308 0 1 43.4s

Fail Rate

Fail Rate 0.04%    ±0
Test 📝 Results 📊 Passed ✅ Failed ❌ Fail Rate (%) 📈
eldritch: process::kill_impl::tests::test_process_kill 3 2 1 33.33    ↑33.33
eldritch: process::kill_impl::tests::test_process_kill 3 2 1 33.33    ↑33.33
eldritch: process::kill_impl::tests::test_process_kill 3 2 1 33.33    ↑33.33

Failed Tests

Failed Tests
❌ eldritch: process::kill_impl::tests::test_process_kill
thread 'process::kill_impl::tests::test_process_kill' (42289) panicked at lib/eldritch/src/process/kill_impl.rs:63:21

Trace:

thread 'process::kill_impl::tests::test_process_kill' (42289) panicked at lib/eldritch/src/process/kill_impl.rs:63:21:
assertion `left == right` failed
  left: false
 right: true
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
eldritch: random::string_impl::tests::test_string_uniform 2 41.8s 43.4s
eldritch: random::string_impl::tests::test_string_uniform 2 41.8s 43.4s
eldritch: random::string_impl::tests::test_string_length 2 8.7s 11.8s
eldritch: random::string_impl::tests::test_string_length 2 8.7s 11.8s
eldritch: runtime::tests::process_bindings 2 4.2s 8.3s
eldritch: runtime::tests::process_bindings 2 4.2s 8.3s
eldritch: runtime::tests::random_bindings 2 3.6s 7.2s
eldritch: runtime::tests::random_bindings 2 3.6s 7.2s
eldritch: sys::dll_reflect_impl::tests::test_dll_reflect_starlark 1 5.5s 5.5s
eldritch-stdlib-tests: tests::test_all_tomes 2 5.2s 5.3s

🍂 No flaky tests in this run.

Github Test Reporter by CTRF 💚

🔄 This comment has been updated

@KCarretto KCarretto marked this pull request as ready for review January 13, 2026 04:28
@KCarretto KCarretto enabled auto-merge January 13, 2026 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants